unit UPharmacyStockTransferRequestSub;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, AdvPanel, cxGraphics,
  cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
  dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
  dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
  dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
  dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue,
  dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver,
  dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver,
  dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
  dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010,
  dxSkinWhiteprint, dxSkinXmas2008Blue, cxGroupBox, DBAdvGlowNavigator,
  cxStyles, dxSkinscxPCPainter, cxCustomData, cxFilter, cxData, cxDataStorage,
  cxNavigator, Data.DB, cxDBData, cxGridLevel, cxClasses, cxGridCustomView,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, UDMPharmacy,
  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
  cxDBLookupComboBox, Vcl.StdCtrls, Vcl.Mask, Vcl.DBCtrls, cxDBEdit, cxCalendar, UDMSettings,
  Vcl.ComCtrls, dxCore, cxDateUtils, RzPanel, RzButton, Vcl.Menus, cxButtons,
  cxCheckBox, cxSpinEdit, frxClass, frxDBSet;

type
  TFPharmacyStockTransferRequestSub = class(TForm)
    AdvPanel1: TAdvPanel;
    AdvPanelStyler1: TAdvPanelStyler;
    cxGroupBox1: TcxGroupBox;
    AdvPanel2: TAdvPanel;
    Label5: TLabel;
    Label4: TLabel;
    cxDBTextEdit1: TcxDBTextEdit;
    RzToolbar1: TRzToolbar;
    RzToolButton1: TRzToolButton;
    RzSpacer1: TRzSpacer;
    RzSpacer2: TRzSpacer;
    RzToolButton2: TRzToolButton;
    DBAdvGlowNavigator1: TDBAdvGlowNavigator;
    cxGroupBox3: TcxGroupBox;
    AdvPanel4: TAdvPanel;
    cxDBDateEdit1: TcxDBDateEdit;
    cxButton1: TcxButton;
    RzSpacer3: TRzSpacer;
    RzSpacer4: TRzSpacer;
    RzToolButton3: TRzToolButton;
    Label1: TLabel;
    cxLookupComboBox1: TcxLookupComboBox;
    Label2: TLabel;
    cxDBLookupComboBox1: TcxDBLookupComboBox;
    cxGroupBox2: TcxGroupBox;
    cxGrid2: TcxGrid;
    cxGrid2DBTableView1: TcxGridDBTableView;
    cxGrid2DBTableView1pharmacy_stock_transfer_id: TcxGridDBColumn;
    cxGrid2DBTableView1pricing_id: TcxGridDBColumn;
    cxGrid2DBTableView1qty: TcxGridDBColumn;
    cxGrid2Level1: TcxGridLevel;
    Label3: TLabel;
    cxSpinEdit1: TcxSpinEdit;
    cxButton2: TcxButton;
    ReTransferRequest: TfrxReport;
    his_pharmacy_transfer_request_report: TfrxDBDataset;
    procedure cxButton1Click(Sender: TObject);
    procedure RzToolButton2Click(Sender: TObject);
    procedure RzToolButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure RzToolButton3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FPharmacyStockTransferRequestSub: TFPharmacyStockTransferRequestSub;

implementation

{$R *.dfm}

procedure TFPharmacyStockTransferRequestSub.cxButton1Click(Sender: TObject);
begin
  Self.AdvPanel2.Enabled := true;
  DMPharmacy.his_pharmacy_stock_transfer_request.Post;
  DMPharmacy.his_pharmacy_stock_transfer_request.RefreshRecord;
  Self.AdvPanel2.Enabled := false;
  Self.AdvPanel4.Enabled := True;
end;

procedure TFPharmacyStockTransferRequestSub.cxButton2Click(Sender: TObject);
begin
  DMPharmacy.his_pharmacy_stock_transfer_request_sub.Insert;
  DMPharmacy.his_pharmacy_stock_transfer_request_sub.FieldByName('pricing_id').Value := Self.cxLookupComboBox1.EditValue;
  DMPharmacy.his_pharmacy_stock_transfer_request_sub.FieldByName('pharmacy_stock_transfer_request_id').Value :=  Self.cxDBTextEdit1.EditValue;
  DMPharmacy.his_pharmacy_stock_transfer_request_sub.FieldByName('qty').Value :=  Self.cxSpinEdit1.EditValue;
  DMPharmacy.his_pharmacy_stock_transfer_request_sub.Post;
  DMPharmacy.his_pharmacy_stock_transfer_request_sub.RefreshRecord;
  Self.cxLookupComboBox1.ClearSelection;
  DMPharmacy.his_pharmacy_transfer_request_report.Refresh;
end;

procedure TFPharmacyStockTransferRequestSub.FormActivate(Sender: TObject);
begin
  DMPharmacy.his_pharmacy_stock.Refresh;
end;

procedure TFPharmacyStockTransferRequestSub.RzToolButton1Click(Sender: TObject);
begin
  Self.AdvPanel2.Enabled := True;
  DMPharmacy.his_pharmacy_stock_transfer_request.Insert;
  DMPharmacy.virtual_pharmacy_stock_transfer_request_sub.Clear;
end;

procedure TFPharmacyStockTransferRequestSub.RzToolButton2Click(Sender: TObject);
begin
  Self.AdvPanel2.Enabled := false;
  Self.AdvPanel4.Enabled := True;
end;

procedure TFPharmacyStockTransferRequestSub.RzToolButton3Click(Sender: TObject);
begin
  Self.ReTransferRequest.ShowReport();
end;

end.
